package com.swgk.core.view.selection;

import android.text.TextUtils;

import java.io.Serializable;
import java.util.List;

public class XChooseEntity implements Serializable {
    private int sort;
    private String typeName;
    private boolean isShow; // 是否展示
    private boolean isHide; // 是否展示
    private List<CommonPopEntity> list;

    private boolean isMultiData; //是否多级数据

    public void setMultiData(boolean multiData) {
        isMultiData = multiData;
    }

    public boolean isMultiData() {
        return isMultiData;
    }


    public XChooseEntity(int sort, String typeName, List<CommonPopEntity> list) {
        this.sort = sort;
        this.typeName = typeName;
        this.list = list;
    }

    public boolean isShow() {
        return isShow;
    }

    public void setShow(boolean show) {
        isShow = show;
    }

    public boolean isHide() {
        return isHide;
    }

    public void setHide(boolean hide) {
        isHide = hide;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public List<CommonPopEntity> getList() {
        return list;
    }

    public void setList(List<CommonPopEntity> list) {
        this.list = list;
    }


    // 会员业绩使用Id
    public String getItemId(int position) {
        if (getList() == null || getList().size() == 0) {
            return "";
        }
        return getList().get(position).getId();
    }

    public String getItemCode(int position) {
        if (getList() == null || getList().size() == 0) {
            return "";
        }
        return getList().get(position).getCode();
    }

    // 会员业绩-会员等级使用no
    public String getItemNo(int position) {
        if (getList() == null || getList().size() == 0) {
            return "";
        }
        return getList().get(position).getNo();
    }

    public String getItemName(int position) {
        if (getList() == null || getList().size() == 0) {
            return getTypeName();
        }
        String pickerViewText = getList().get(position).getPickerViewText();
        if (TextUtils.equals("全部", pickerViewText) || TextUtils.equals("不限", pickerViewText)) {
            return getTypeName();
        }
        return pickerViewText;
    }
}
